package lk.icta;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UnitTestContext {

    private static ApplicationContext context;
    private static UnitTestContext instance;
    private final static String CONFIG_FILE = "unitTestKeepDB_applicationContext.xml";

    public static UnitTestContext getInstance() {
        if (null == instance) {
            instance = new UnitTestContext();
            context = new ClassPathXmlApplicationContext(
                    CONFIG_FILE);
        }
        return instance;
    }

    public Object getBean(String bean) {
        return context.getBean(bean);
    }

    public ApplicationContext getApplicationContext(){
        return context;
    }
}